<include file="application/home/view/public/header.html"/>
      <!-- /.aside -->
      <section id="content">
        <section class="vbox">
          <section class="scrollable padder">
             <header class="header bg-light bg-gradient b-b">
            <p>提现</p>
          </header>
          <form class="form-horizontal" data-validate="parsley">
                <section class="panel panel-default">
                    <div class="panel-body">
                    <header class="panel-heading"> <strong>提现</strong> </header>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">提现：</label>
                        <div class="col-lg-4">
                          	<select id="type" name='type' class="form-control">
								<option value="">请先选择</option>
								<foreach name="type" item="v">
								<option value="{$v.id}">{$v.name}</option>
								</foreach>
							</select>
                        </div>
                      </div>
                      <div class="line line-dashed line-lg pull-in"></div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label" id="ass">我的资产</label>
                        <div class="col-lg-4">
                        <input type="text" class="form-control" id="zichan" name="assect" disabled>
                        </div>
                      </div>
                      <div class="line line-dashed line-lg pull-in"></div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">提现方式:</label>
                        <div class="col-lg-4">
                          	<select id="pay" name='type' class="form-control">
								<option value="1">银行卡</option>
								<option value="2">支付宝</option>
							</select>
                        </div>
                      </div>
                      <div class="line line-dashed line-lg pull-in"></div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label" id="ass">卡号:</label>
                        <div class="col-lg-4">
                          <input type="text" disabled id="cardnum" name="cardnum" value="{$member.bank_card}" class="form-control" placeholder="">
                        </div>
                      </div>

					 <div class="line line-dashed line-lg pull-in"></div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">提现金额:</label>
                        <div class="col-lg-4">
                         <input type="text" id="money" name="money" class="form-control" placeholder="">
                        </div>
                      </div>
                      <!-- <div class="line line-dashed line-lg pull-in"></div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">二级密码:</label>
                        <div class="col-lg-4">
                          <input type="password" id="pwd" name="num" class="form-control" placeholder="">
                        </div>
                      </div> -->
                    </div>
                    <footer class="panel-footer text-right bg-light lter">
                      <button type="button" class="btn btn-success btn-s-xs" onclick="sub()" >提 交</button>
                    </footer>
                    <header class="panel-heading">提现记录</header>
		            <div class="table-responsive">
		                <table class="table table-striped b-t b-light text-sm">
		                  <thead>
		                    <tr>
		                      <th>提现金额</th>
		                      <th>手续费</th>
		                      <th>实际到账</th>
		                      <th>时间</th>
		                      <th>状态</th>
		                      <th>收益类型</th>
		                    </tr>
		                  </thead>
		                  <tbody>
		                    <foreach name="list" item="v">
		                    <tr>
		                      	<td>{$v.all_money}</td>
								<td>{$v.fee}</td>
								<td>{$v.num}</td>
								<td>{$v.add_time|date='Y-m-d H:i:s',###}</td>
								<td>
								<eq name="v.status" value='0'>
									等待审核
								 </eq>
								 <eq name="v.status" value='2'>
									完成
								 </eq>
								 <eq name="v.status" value='-1'>
									审核驳回
								 </eq>
								</td>
								 <td>
								 	提现
								 </td>
		                    </tr>
		                    </foreach>
		                  </tbody>
		                </table>
		              </div>
		              <footer class="panel-footer">
		                <div class="row">
		                  <div class="col-sm-4 hidden-xs">
		                  <!--  这里不可以删掉 -->
		                  </div>
		                  <div class="col-sm-4 text-center">  </div>
		                  <div class="col-sm-4 text-right text-center-xs">
		                    <ul class="pagination pagination-sm m-t-none m-b-none">
		                      <li>{$page}</li>
		                    </ul>
		                  </div>
		                </div>
		              </footer>
                  </section>
          </form>
          </section>
        </section>
        <a href="#" class="hide nav-off-screen-block" data-toggle="class:nav-off-screen" data-target="#nav"></a> </section>
      <aside class="bg-light lter b-l aside-md hide" id="notes">
        <div class="wrapper">Notification</div>
      </aside>
    </section>
  </section>
</section>
<script src="__PUBLIC__/home/js/app.v2.js"></script> <!-- Bootstrap --> <!-- App --> <script src="__PUBLIC__/home/js/charts/easypiechart/jquery.easy-pie-chart.js" cache="false"></script> <script src="__PUBLIC__/home/js/charts/sparkline/jquery.sparkline.min.js" cache="false"></script> <script src="__PUBLIC__/home/js/charts/flot/jquery.flot.min.js" cache="false"></script> <script src="__PUBLIC__/home/js/charts/flot/jquery.flot.tooltip.min.js" cache="false"></script> <script src="__PUBLIC__/home/js/charts/flot/jquery.flot.resize.js" cache="false"></script> <script src="js/charts/flot/jquery.flot.grow.js" cache="false"></script> <script src="__PUBLIC__/home/js/charts/flot/demo.js" cache="false"></script> <script src="__PUBLIC__/home/js/calendar/bootstrap_calendar.js" cache="false"></script> <script src="__PUBLIC__/home/js/calendar/demo.js" cache="false"></script> <script src="__PUBLIC__/home/js/sortable/jquery.sortable.js" cache="false"></script>
<script src="__PUBLIC__/js/layer/layer.js" type="text/javascript"></script>
</body>
</html>
 <script>
	function cashout(){
		var money =$('#money').val();
		var type = $('#type').val();
		if(money == ""){
			layer.msg("请输入提现金额");return;
		}
		if(money>$('rmb').val()){
			layer.msg("余额不足，请核实金额在提现");return;
		}
		if(money%100!=0){
			layer.msg("提现金额请输入100的倍数");return;
		}	
		if(type == ''){
			layer.msg("请选择提现方式");return;
		}

		var password=$("#pwd").val();
		if(password == ""){
			layer.msg("请输入交易密码");return;
		}
		var url="{:U('Money/cashout')}";
		$.post(url,{'money':money,'password':password,'type':type},function(data){
			layer.msg(data.info);
			if(data.status==1){
				window.location.reload();//刷新当前页面
			}
			
		});
	}
	</script>

<include file="application/home/view/public/footer.html"/>
	<script>
	$("#type").change(function(){
		switch(parseInt($(this).val())){
			case 1:
				$("#zichan").val("{$member_account['account_type_1']}");
				break;
			case 2:
				$("#zichan").val("{$member_account['account_type_2']}");
				break;
			case 3:
				$("#zichan").val("{$member_account['account_type_3']}");
				break;
			case 4:
				$("#zichan").val("{$member_account['account_type_4']}");
				break;
			case 5:
				$("#zichan").val("{$member_account['account_type_5']}");
				break;
			default:
				$("#zichan").val(0);
				break;
		}
	});
	
	
	$("#pay").change(function(){
		if($(this).val()==1){
			$("#cardnum").val('{$member.bank_card}');
		}
		if($(this).val()==2){
			$("#cardnum").val('{$member.zhifubao}');
		}
	});
	
	function sub(){
		var bool = true;
		var type = $("#type").val();
		var zican = $("#zichan").val();
		var money = $("#money").val();
		var pay = $("#pay").val();
		var cardnum = $("#cardnum").val();
		
		// var pwd = $("#pwd").val();
		if(type==""){
			alert('请选择提现积分');
			return false;
		}
		if(money==""){
			alert("请输入提现金额");
			return false;
		}
		if(!/^\d+$/.test(money)){
			alert("提现金额格式错误");
			return false;
		}
		if(money=="0"){
			alert("提现金额不能为0");
			return false;
		}
		
		// if(pwd==""){
		// 	alert('请输入交易密码');
		// 	return false;
		// }
		if(bool){
			bool = false;
			$.post("{:U('Money/tixian')}",{type:type,money:money,pay:pay,cardnum:cardnum},function(res){
				layer.msg(res.message);
				if(res.result_code==100){
					
					setTimeout(function () { 
			      	 	window.location.reload();
			    	}, 2000);
				}else{
					bool = true;
					return false;
				}
			})
		}
	}
	
	
	</script>